package test
{
	import away3d.tools.utils.TextureUtils;
	
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.text.AntiAliasType;
	import flash.text.Font;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import loaders.SimpleLoader;
	import org.musince.util.TextFieldUtil;
	
	[SWF(width="1280", height="720", backgroundColor="0x000000")]
	
	public class FontTest extends Sprite
	{
		public var loader:Loader; 
		
		public function FontTest()
		{
			super();
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
			loader.load(new URLRequest("../asset/flash/FontComp.swf"));
			stage.color = 0x000000;			
		}
		
		public function onLoaded(e:Event):void {
			var mc:MovieClip = loader.contentLoaderInfo.content as MovieClip;
			var fonts:Array = Font.enumerateFonts(false);
			for each (var font:String in fonts) {
				trace(font);
			}
			var t1:TextField = mc.t2;
			addChild(mc);
			var tf:TextField = new TextField;
//			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.width = 1280;
			tf.embedFonts = true;
			tf.selectable = false;
			tf.antiAliasType = AntiAliasType.ADVANCED;
			tf.y = 200;
//			tf.x = 10;
			var tft:TextFormat = tf.defaultTextFormat;
			tft.size = 42;
			tft.color = 0xFFFFFF;
//			tft.letterSpacing = 2;
			//			tft.size = 80;
			tft.font = "STKaiti";
//			tft.font = "KaiTi_GB2312";
			tf.defaultTextFormat = tft;
//			tf.defaultTextFormat = t1.defaultTextFormat;
			tf.text = "时间永远都在无情的流逝 无论如何挣扎 生命的尽头 终究逃不出悲剧...";
//			tf.text = "with or without you";
			
			
//			tf.text = "换个内容试试";
//			tf.setTextFormat(t1.getTextFormat());
			
//			t1.scaleX = t1.scaleY = 2;
//			tf.embedFonts = false;
//			t1.text = "换个内容试试";
			addChild(tf);
		}
	}
}